package com.xxpt.common.enums;

public enum UserTypeEnum {
    //0系统账号，1个人 2角色账号；3子账号
    SYS(0, "系统账号"),
    PERSON(1, "个人"),
    DEPARTMENT(2, "角色账号"),
    DEPARTMENT_CHILD(3, "子账号")   ;

    private Integer val;
    private String name;

    UserTypeEnum(Integer val, String name){
        this.val = val;
        this.name = name;
    }

    public static UserTypeEnum getUserTypeEnum(Integer val) {
        for (UserTypeEnum typeEnum : UserTypeEnum.values()) {
            if (typeEnum.getVal().equals(val))
                return typeEnum;
        }
        return null;
    }

    public static String getUserTypeName(Integer val) {
        if (val == null)
            return "";
        for (UserTypeEnum typeEnum : UserTypeEnum.values()) {
            if (typeEnum.getVal().equals(val))
                return typeEnum.getName();
        }
        return "";
    }

    public Integer getVal() {
        return val;
    }

    public void setVal(Integer val) {
        this.val = val;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}